﻿using System.Web.Mvc;
using System.Web.Routing;

namespace HopNguyenCms.App_Start
{
    public class RouteConfig
    {
        public static void RegisterRoutes(RouteCollection routes)
        {
            routes.IgnoreRoute("{resource}.axd/{*pathInfo}");

            routes.MapRoute(
                name: "View elmah logs",
                url: "cpanel/elmah/{type}",
                defaults: new { controller = "Cpanel", action = "Elmah", type = UrlParameter.Optional }
            );

            routes.MapRoute(
                name: "Control panel",
                url: "cpanel/{action}/{id}",
                defaults: new { controller = "Cpanel", action = "Index", id = UrlParameter.Optional }
            );

            routes.MapRoute(
                name: "Index",
                url: "",
                defaults: new { controller = "Website", action = "Index" }
            );

            routes.MapRoute(
                name: "search video",
                url: "searchvideo",
                defaults: new { controller = "Website", action = "searchvideo" }
            );

            routes.MapRoute(
                name: "search content",
                url: "search",
                defaults: new { controller = "Website", action = "searchcontent" }
            );

            routes.MapRoute(
                name: "Watch",
                url: "watch",
                defaults: new { controller = "Website", action = "Watch" }
            );

            routes.MapRoute(
                name: "Create Video",
                url: "createyoutube",
                defaults: new { controller = "Website", action = "CreateYoutube" }
            );

            routes.MapRoute(
                name: "Popular videos",
                url: "popular.html",
                defaults: new { controller = "Website", action = "Popular" }
            );

            routes.MapRoute(
                name: "How to download",
                url: "how-to-download.html",
                defaults: new { controller = "Website", action = "HowToDownload" }
            );

            routes.MapRoute(
                name: "Contact",
                url: "contact.html",
                defaults: new { controller = "Website", action = "Contact" }
            );

            routes.MapRoute(
                name: "Donate",
                url: "donate.html",
                defaults: new { controller = "Website", action = "Donate" }
            );

            routes.MapRoute(
                name: "Send contact",
                url: "sendcontact",
                defaults: new { controller = "Website", action = "SendContact" }
            );

            routes.MapRoute(
                name: "Privacy",
                url: "privacy-policy.html",
                defaults: new { controller = "Website", action = "PrivacyPolicy" }
            );

            routes.MapRoute(
                name: "Auto sitemap",
                url: "autogensitemap",
                defaults: new { controller = "Website", action = "AutoGenSitemap" }
            );

            routes.MapRoute(
                name: "ajax load all video",
                url: "othervideodownload",
                defaults: new { controller = "Website", action = "OtherVideoDownload" }
            );

            routes.MapRoute(
                name: "Error 404",
                url: "error.html",
                defaults: new { controller = "Website", action = "Error" }
            );

            routes.MapRoute(
                name: "Watch video",
                url: "video/{alias}.{slug}",
                defaults: new { controller = "Website", action = "WatchVideo", alias = UrlParameter.Optional, slug = "html" }
            );

            routes.MapRoute(
                name: "Page",
                url: "{page}.{slug}",
                defaults: new { controller = "Website", action = "Index", page = UrlParameter.Optional, slug = "html" }
            );

            routes.MapRoute(
                name: "Detail",
                url: "{page}/{alias}.{slug}",
                defaults: new { controller = "Website", action = "Index", page = UrlParameter.Optional, alias = UrlParameter.Optional, slug = "html" }
            );

        }
    }
}